package com.mjf.kxml.enums;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 * desc 发送标识枚举
 * </p>
 *
 * @author chenshoumeng
 * @date 2025/6/4 10:58
 */
@Getter
public enum InvoiceTypeEnum {

    INVOICE_RECEIVABLE("1", "应收"),
    INVOICE_MEET("2", "应付"),

    ;

    private static final Map<String, InvoiceTypeEnum> LOOKUP_MAP = new HashMap<>(4, 1);

    static {
        for (InvoiceTypeEnum cstEnum : InvoiceTypeEnum.values()) {
            LOOKUP_MAP.put(cstEnum.codes, cstEnum);
        }
    }

    InvoiceTypeEnum(String codes, String name) {
        this.codes = codes;
        this.name = name;
    }

    /**
     * -- GETTER --
     *
     * @return 枚举值
     */
    private String codes;
    private String name;


    /**
     * 根据枚举值获取枚举
     *
     * @param codes codes
     * @return 若枚举值存在，返回对应的枚举，否则返回 null
     */
    public static InvoiceTypeEnum formValue(String codes) {
        return LOOKUP_MAP.get(codes);
    }



}
